//-----------------------------------------------------------------------
// <copyright file="TypeCompanyService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class TypeCompanyService
    {
        #region TypeCompany

        public static void CreateTypeCompany(TypeCompany typeCompany)
        {            
            try
            {
                TypeCompanyDAO typeCompanyDAO = new TypeCompanyDAO();
                typeCompanyDAO.CreateTypeCompany(typeCompany);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateTypeCompanyException, ex);
            }
        }        

        public static void UpdateTypeCompany(TypeCompany typeCompany)
        {            
            try
            {
                TypeCompanyDAO typeCompanyDAO = new TypeCompanyDAO();
                typeCompanyDAO.UpdateTypeCompany(typeCompany);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateTypeCompanyException, ex);
            }
        }        

        public static void DeleteTypeCompany(int typeCompanyID)
        {            
            try
            {
                TypeCompanyDAO typeCompanyDAO = new TypeCompanyDAO();
                typeCompanyDAO.DeleteTypeCompany(typeCompanyID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteTypeCompanyException, ex);
            }
        }
        
        public static TypeCompany GetTypeCompany(int typeCompanyID)
        {            
            try
            {
                TypeCompanyDAO typeCompanyDAO = new TypeCompanyDAO();
                return typeCompanyDAO.GetTypeCompany(typeCompanyID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTypeCompanyException, ex);
            }
        }                

        public static TypeCompanyCollection GetTypeCompanyList(TypeCompanyColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                TypeCompanyDAO typeCompanyDAO = new TypeCompanyDAO();
                return typeCompanyDAO.GetTypeCompanyList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTypeCompanyListException, ex);
            }
        }        

        public static TypeCompanyCollection GetTypeCompanyList(TypeCompanyColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                TypeCompanyDAO typeCompanyDAO = new TypeCompanyDAO();
                return typeCompanyDAO.GetTypeCompanyList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTypeCompanyListException, ex);
            }
        }        

	    public static TypeCompanyCollection GetTypeCompanyListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                TypeCompanyDAO typeCompanyDAO = new TypeCompanyDAO();
                return typeCompanyDAO.GetTypeCompanyListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTypeCompanyListException, ex);
            }
        }        

        public static TypeCompanyCollection GetTypeCompanyListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                TypeCompanyDAO typeCompanyDAO = new TypeCompanyDAO();
                return typeCompanyDAO.GetTypeCompanyListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTypeCompanyListException, ex);
            }
        }        

        #endregion
    }
}